<?php

namespace App\Admin\Controllers;

use App\Http\Controllers\Controller;
use Encore\Admin\Controllers\Dashboard;
use Encore\Admin\Facades\Admin;
use Encore\Admin\Layout\Column;
use Encore\Admin\Layout\Content;
use Encore\Admin\Layout\Row;
use Illuminate\Support\Facades\DB;

class HomeController extends Controller
{
    public function index(Content $content): Content
    {
        return $content->body(view('index', array_merge((array)DB::select(__('sql.tj.order', [
        'day' => now()->startOfDay()->timestamp,
        'month' => now()->startOfMonth()->timestamp,
        'year' => now()->startOfYear()->timestamp,
        'userId' => Admin::user()->user_id,
    ]))[0], (array)Db::select(__('sql.tj.user', [
            'day' => now()->startOfDay()->timestamp,
            'month' => now()->startOfMonth()->timestamp,
            'year' => now()->startOfYear()->timestamp,
            'lastMonth' => now()->subMonth()->startOfMonth()->timestamp,
            'lastYear' => now()->subYear()->startOfYear()->timestamp,
        ]))[0])));
    }
}
